#include<iostream>
#include<cmath> 
using namespace std;
int main()
{
	int i,j,k,t=0;
	for(i=2;i<=1000;i++)
	{
		k=(int)sqrt(i);
		for(j=2;j<=k;j++)
			if(i%j==0)
			   break;
		if(j>k)
		{
			t++;
	        cout<<i<<" ";
	        if(t%5!=0)
	           continue;
	        else
	           cout<<endl;
	    }
		
	}
	return 0;
}
